var express = require('express')
var app = express()
var mysql = require("mysql")
var connection = mysql.createConnection({
	host: "180.97.195.131",
	port: 3306,
	user: "test2",
	password: "test2",
	database: "test2"
})
app.use("/", express.static('public'))

app.get('/goodslike',function(req,res){
	connection.query(`SELECT g.title,g.img,g.unitPrice,g.oldPrice FROM goods_favourite gf
		INNER JOIN good_list g ON gf.goodsid = g.id where userid=?`,[req.query.userid],function(err,data){
			if(err){
				console.log(err)
			}else{
				res.json(data)
			}
		})
})
app.listen(8888, function() {
	console.log("程序已启动，端口号为8888")
})